package com.travel.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.travel.domain.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper extends BaseMapper<User> {

    /**
     * 根据openid查询用户
     * @param openid
     * @return
     */
    @Select("select * from user where openid = #{openid}")
    User getByOpenid(String openid);

    /**
     * 插入数据
     *
     * @param user
     * @return
     */
    int insert(User user);

    @Select("select user.openid from user where id = #{userId}")
    User getOpenidByUserId(Long userId);
}
